home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / cg / saveattrib.rexx < prev    next >
OS/2 REXX Batch file  |  1996-02-21  |  3KB  |  91 lines

  1. /* SaveAttrib -- Save current char settings to rexx macro */
  2. /* By Bob Caron ©1994 NewTek, Inc.                        */
  3.  
  4. filnam = 'ENV:SaveAttrib.state'
  5. version = 'SaveAttrib v1.4'
  6.  
  7. if (exists(filnam)) then do
  8.     if (~open(state, filnam, 'R')) then break
  9.     if (readln(state) ~= version) then break
  10.     file=readln(state)
  11.     end
  12.     call close state
  13.  
  14. if file="FILE" | file="" then
  15.    file="Toaster:Arexx/CG/AttribScripts/AttribSet.rexx"
  16.  
  17. if lastpos('/',file,length(file)-1)~=0 then do
  18.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  19.    path=left(file,(lastpos('/',file,length(file))-1))
  20.    end
  21. else do
  22.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  23.    path=left(file,(lastpos(':',file,length(file))))
  24.    end
  25.  
  26. call addlib(CG_AREXX,0)
  27. outfile=REQ_FILE("Save Character Attributes As...",filenam,path)
  28.  
  29. if outfile="" then
  30.    exit
  31.  
  32. file=script
  33. if (open(state, filnam, 'W')) then do
  34.     call writeln state, version
  35.     call writeln state, outfile
  36.     call close state
  37. end
  38.  
  39. if exists(outfile) then do
  40.    x=req_ask("Write Over File '"||outfile||"'?")
  41.    if x=0 then do
  42.       x=req_tell("Canceled")
  43.       exit
  44.       end
  45.    end
  46.  
  47. stype=0
  48. if (~open(outfd,outfile,W)) then do
  49.      call REQ_TELL("Can't open output:",outfile)
  50.      exit
  51.      end
  52.  
  53.    bordbotr=translate(GET_BORD(BOTR),","," ")
  54.    charrgba=translate(GET_CHAR(RGBA),","," ")
  55.    charbotr=translate(GET_CHAR(BOTR),","," ")
  56.    shadrgba=translate(GET_SHAD(TOPR),","," ")
  57.    bordrgba=translate(GET_BORD(TOPR),","," ")
  58.    bordprio=GET_BORD(PRIO)
  59.    if get_shad(PRIO)=0 then prio="B"
  60.       else prio="T"
  61.    if get_shad(type)="None" then stype=0
  62.    if get_shad(type)="Cast" then stype=2
  63.    if get_shad(type)="Drop" then stype=1
  64.  
  65.    writeln(outfd,"/* "||outfile" -- An Attribute Setter   */")
  66.    writeln(outfd,"/* By A. Random User ©1994 NewTek, Inc. */")
  67.    writeln(outfd,"/* (Based on a program by Bob Caron.)   */")
  68.    writeln(outfd,"")
  69.    writeln(outfd,"call addlib(CG_AREXX,0)")
  70.    writeln(outfd,"")
  71.    writeln(outfd,"CALL SET_CHAR(FILL,'"||get_char(fill)||"')")
  72.    writeln(outfd,"CALL SET_CHAR(BOTR,"||charbotr||")")
  73.    writeln(outfd,"CALL SET_CHAR(RGBA,"||charrgba||")")
  74.    writeln(outfd,"CALL SET_BORD(FILL,'"||get_bord(fill)||"')")
  75.    writeln(outfd,"CALL SET_BORD(BOTR,"||bordbotr||")")
  76.    writeln(outfd,"CALL SET_BORD(SIZE,"||left(get_bord(SIZE),1)||")")
  77.    writeln(outfd,"CALL SET_BORD(PRIO,"||bordprio||")")
  78.    writeln(outfd,"CALL SET_BORD(TOPR,"||bordrgba||")")
  79.    writeln(outfd,"CALL SET_SHAD(TYPE,"||stype||")")
  80.    writeln(outfd,"CALL SET_SHAD(SPOT,"||get_shad(SPOT)||")")
  81.    writeln(outfd,"CALL SET_SHAD(PRIO,"||prio||")")
  82.    writeln(outfd,"CALL SET_SHAD(SIZE,"||get_shad(SIZE)||")")
  83.    writeln(outfd,"CALL SET_SHAD(TOPR,"||shadrgba||")")
  84.    writeln(outfd,"CALL REMLIB(CG_AREXX)")
  85.  
  86.    call close(outfd)
  87.    call REQ_TELL("Saved...")
  88.    call REMLIB(CG_AREXX)
  89. exit
  90.  
  91.